package pers.wang.toolset.coder.statecode;

import pers.wang.toolset.coder.statecode.state.CommonErrorStateCode;
import pers.wang.toolset.coder.statecode.state.ServiceStateCode;
import pers.wang.toolset.coder.statecode.state.SystemStateCode;

public class ResponseHelper {
	public static final <T> CommonResponse<T> success(T data) {
		return new CommonResponse<T>(ServiceStateCode.SUCCEES.getCode(), data);
	}public static final <T> CommonResponse<T> success(T data,String message) {
		return new CommonResponse<T>(ServiceStateCode.SUCCEES.getCode(), data,message);
	}
	

	public static final <T> CommonResponse<T> emptyData() {
		return new CommonResponse<T>(ServiceStateCode.EMPTY.getCode(), ServiceStateCode.EMPTY.getDescribe());
	}

	public static final <T> CommonResponse<T> emptyData(String msg) {
		return new CommonResponse<T>(ServiceStateCode.EMPTY.getCode(), msg);
	}

	public static final <T> CommonResponse<T> serverError() {
		return new CommonResponse<T>(SystemStateCode.SERVER_ERROR.getCode(),
				SystemStateCode.SERVER_ERROR.getDescribe());
	}

	public static final <T> CommonResponse<T> invalidToken() {
		return new CommonResponse<T>(CommonErrorStateCode.INVALID_TOKEN.getCode(),
				CommonErrorStateCode.INVALID_TOKEN.getDescribe());
	}

	public static final <T> CommonResponse<T> serviceError(String msg) {
		return new CommonResponse<T>(ServiceStateCode.ERROR.getCode(), msg);
	}

	public static final <T> CommonResponse<T> accountLockout() {
		return new CommonResponse<T>(SystemStateCode.ACCOUNT_LOCKOUT.getCode(),
				SystemStateCode.ACCOUNT_LOCKOUT.getDescribe());
	}

	public static final <T> CommonResponse<T> notEnough() {
		return new CommonResponse<T>(CommonErrorStateCode.NOT_ENOUGH.getCode(),
				CommonErrorStateCode.NOT_ENOUGH.getDescribe());
	}

	public static final <T> CommonResponse<T> nonAuthorized() {
		return new CommonResponse<T>(SystemStateCode.NO_AUTHORITY.getCode(),
				SystemStateCode.NO_AUTHORITY.getDescribe());
	}
	
	public static final <T> CommonResponse<T> serviceTimeout() {
		return new CommonResponse<T>(SystemStateCode.SERVICE_TIMEOUT.getCode(),
				SystemStateCode.SERVICE_TIMEOUT.getDescribe());
	}
	
	public static final <T> CommonResponse<T> methodNotAllowed() {
		return new CommonResponse<T>(SystemStateCode.METHOD_NOT_ALLOWED.getCode(),
				SystemStateCode.METHOD_NOT_ALLOWED.getDescribe());
	}
	public static final <T> CommonResponse<T> requestError() {
		return new CommonResponse<T>(SystemStateCode.REQUEST_ERROR.getCode(),
				SystemStateCode.REQUEST_ERROR.getDescribe());
	}
	
}
